import App from './App'

// #ifndef VUE3
import Vue from 'vue'
Vue.config.productionTip = false;
import store from './store'
Vue.prototype.$store = store
App.mpType = 'app'
const app = new Vue({
	store,
    ...App
})
app.$mount()
// #endif

// #ifdef VUE3
import { createSSRApp } from 'vue'
export function createApp() {
  const app = createSSRApp(App)
  return {
    app
  }
}
// #endif

// 第三放UI布局 -- UIView组件
import uView from "uview-ui";
Vue.use(uView);

// 注入通知事件插件
import XEventBusPlugin from '@/plugins/EventBus/XEventBusPlugin.js'
Vue.use(XEventBusPlugin)

// 全局挂载
import Config from '@/config/index.js'
Vue.prototype.$Config = Config;

import TOOLS from '@/tools/tools.js'
Vue.prototype.$TOOLS = TOOLS

// 工具函数
Vue.filter('sysDataFilter', (code, data) => {
 	const res = data.filter(item => item.code === code)[0]
 	return res ? res.name : ''
})

// 全局注册组件
import XLoading from './components/loading/xLoading.vue'
import Login from '@/components/login/index.vue';
import Price from '@/components/price/index.vue';
import agreementCheck from './components/agreementCheck/index.vue';
import XFooter from '@/components/footer/x-footer.vue'
import XEmpty from '@/components/empty/xEmpty.vue'

Vue.component('x-loading', XLoading);
Vue.component('login',Login)
Vue.component('price',Price)
Vue.component('agreement-check',agreementCheck)
Vue.component('x-footer', XFooter);
Vue.component('x-empty', XEmpty);


//请求加载组件
function showLoading(){ //挂载全局显示请求加载动画
	store.commit('request_show_loading');
}
function hideLoading(){ //挂载全局隐藏请求加载动画
	store.commit('request_hide_loading');
}
Vue.prototype.$showLoading = showLoading; //全局显示动画可以 this.$showLoading();
Vue.prototype.$hideLoading = hideLoading; //全局隐藏动画可以 this.$hideLoading();

